<?php
namespace Cyfy\Modules\FastLogin\Forms;

use \Cyfy\Message;
use \Cyfy\Modules\Forms;
use \Cyfy\Modules\FastLogin\Module;

class Login extends Forms\Form
{
	function structure()
	{		
        // reloads page
        $this -> action = \Cyfy\Cyfy ::  $query;
		
		$i = new Forms\TextBox("username", Module :: t(10));
		$i -> required = true;
		$i -> maxlength = 50;
		$this -> addItem($i);
		
		$i = new Forms\TextBox("password", Module :: t(20));
		$i -> required = true;
		$i -> password = true;
		$i -> maxlength = 50;
		$this -> addItem($i);
		
		$b = new Forms\Button(Module :: t(30), Forms\Button::OK);
		$this -> addButton($b);
		
		$b = new Forms\Button(Module :: t(40), Forms\Button::CANCEL);
        $b -> onClick = "Overlay.hide('fastLogin'); return false";
		$this -> addButton($b);
    }
  
	function validate()
	{
		return \Cyfy\Modules\Users\Current :: login($this->get("username"), $this->get("password"));
	}
  
	function submit()
	{  
		return true;     
	}	
}